package tpenchere.controllers;

import javax.swing.ActionMap;

import org.jdesktop.application.ResourceMap;

import tpenchere.application.MainApplication;
import tpenchere.client.impl.ClientProvider;
import tpenchere.client.impl.EnchereClientImpl;
import tpenchere.service.Client;
import tpenchere.service.ClientHolder;
import tpenchere.service.MainContext;
import tpenchere.service.SessionHolder;
import tpenchere.ui.AbstractView;

public class DefaultController implements ControllerInterface {
	protected final ActionMap actionMap = MainApplication.getApplication().getContext().getActionMap(this.getClass(), this);
    protected final ResourceMap resourceMap = MainApplication.getApplication().getContext().getResourceMap(this.getClass());
	
	protected ClientProvider provider = ClientHolder.getInstance().getProvider();
	protected SessionHolder session = SessionHolder.getInstance();
	
	public ActionMap getActionMap() {
		// TODO Auto-generated method stub
		return actionMap;
	}
	
	public ResourceMap getResourceMap() {
		return resourceMap;
	}
	
	public void switchToView(AbstractView.ViewType pViewType) {
		MainContext.getInstance().getMainController().mainWindow.switchToView(pViewType);
	}
	
	public void switchToView(AbstractView.ViewType pViewType, Object args) {
		MainContext.getInstance().getMainController().mainWindow.switchToView(pViewType, args);
	}
	
	public void switchToView(String pViewType) {
		MainContext.getInstance().getMainController().mainWindow.switchToView(pViewType, null);
	}
	
	public void switchToView(String pViewType, Object args) {
		MainContext.getInstance().getMainController().mainWindow.switchToView(pViewType, args);
	}
}
